package com.hjwoo.app.utils;

/**
 * Created by liuderu on 2016/3/25.
 */

import android.content.Context;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;

public class PackageUtils
{

    public PackageUtils()
    {

    }

    /**
     * 获取版本名称
     * Created by zhaokaiwen on 2016/4/25.
     *
     * @param context
     * @return 版本号
     * @throws Exception
     */
    public static String getVersionName(Context context) throws Exception
    {
        PackageManager packageManager = context.getPackageManager();
        PackageInfo    packInfo       = packageManager.getPackageInfo(context.getPackageName(), 0);
        String         version        = packInfo.versionName;
        return version;
    }
}
